<template>
  <view class="cash-wallet-details">
	 <detailsList :title="'钱包记录'" :list="state.tableData"></detailsList>
  </view>
</template>

<script setup>
import { ref, reactive } from "vue";
import { onLoad, onReachBottom, onShow } from "@dcloudio/uni-app";
import { customNav } from "../../utils/customNav";
import detailsList from '@/components/details-list/index.vue'
import {gettbUserPurseLogsListApi} from "@/api/user/cashWallet.js"

const state = reactive({
	tableData:[],
	pageNo:1,
	pageSize:10,
	total:0,
})

// 获取详情列表
const getDetailsList = ()=>{
	const postData={
		startDate:0,
		endDate:0,
		"pageNo": state.pageNo,
		"pageSize": state.pageSize,
	}
	gettbUserPurseLogsListApi(postData).then(data=>{
		state.tableData = state.tableData.concat(data.data.records)
		state.total = data.data.total
	})
}

const scrollToLower = () => {
  if (state.total > state.pageNo * state.pageSize) {
    state.pageNo++;
    getDetailsList();
  }
};

onReachBottom(() => {
  scrollToLower();
});



onLoad(() => {
  
})
onShow(() => {
  getDetailsList()
});
</script>

<style lang="less" scoped>
@import url(../lib/index.less);
</style>